<?php
session_start();
include("connect.php");
include("functions.php");
$username = security($_POST['name']);
$password = security($_POST['pwd']);

$query = "SELECT * FROM M_USER WHERE jcu_email='$username' AND password='$password'";
$result = mysql_query($query)or die(mysql_error());
$num_row = mysql_num_rows($result);
$row=mysql_fetch_array($result);
if( $num_row >=1 ) {
	$_SESSION[userid] = $row[user_id];
	echo "success";
}else{
	echo "failed";
}

?>